﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CommonListN.aspx.cs" ValidateRequest="false" Inherits="TaoSH.View.CommonListN" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <link rel="stylesheet" href="../../CSS/bootstrap3.2/css/bootstrap.css" />
    <link rel="stylesheet" href="../../JqueryPlug/BootstrapTable/bootstrap-table.css" />
    <link rel="stylesheet" href="../../JqueryPlug/YanTip/YanTip.css" />

</head>
<body>
    <form id="form1" runat="server">
        <div class="container-fluid maindiv" style="margin-top: 20px" id="dvContent">
            <asp:PlaceHolder runat="server" ID="QueryCon" />


            <!-- Default panel contents -->

            <!-- Table -->
            <table id="FTGrid">
            </table>


            <input type="hidden" id="tabledata" value="" runat="server" />
            <input type="hidden" id="hidselID" value="" runat="server" />
            <input type="hidden" id="hidQueryWhere" value="" runat="server" />
        </div>
    </form>
    <script type="text/javascript" src="../../Scripts/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="../../Scripts/json2.js"></script>
    <script type="text/javascript" src='../../JqueryPlug/lhgdialog/lhgdialog.js?skin=discuz'></script>
    <script type="text/javascript" src="../../CSS/bootstrap3.2/js/bootstrap.js"></script>
    <script type="text/javascript" src="../../JqueryPlug/Toast/toastr.js"></script>
    <script type="text/javascript" src="../../JqueryPlug/BootstrapTable/bootstrap-table.js"></script>
    <script type="text/javascript" src="../../JqueryPlug/BootstrapTable/locale/bootstrap-table-zh-CN.js"></script>

    <script type="text/javascript" src="../../JqueryPlug/YanTip/YanTip.js"></script>
    <script type="text/javascript" src="../../Scripts/B2CCommon.js"></script>
    <script type="text/javascript">
        var tabledata = $("#tabledata").val();
        var tab = null;
        var FormCode = ComFunJS.getQueryString("FormCode");
        var ListType = ComFunJS.getQueryString("ListType");//List类型,LIST正常List页面,SELECT选择界面
        var SelType = ComFunJS.getQueryString("SelType") != "MUL";//是单选还是多选
        $(document).ready(function () {

            var jspath = "../../View/JSList/" + FormCode + ".js";
            $.getScript(jspath, function () {

                //加入chack列
                option.columns.unshift({
                    field: 'Table_Check',
                    checkbox: true,
                    onLoadSuccess: function () {


                        alert(1)
                    },
                })
               $("#FTGrid").bootstrapTable({
                    singleSelect: SelType,
                    checkboxHeader: false,
                    clickToSelect: true,
                    striped: true,
                    pagination: true,
                    pageSize: 10,
                    pageList: [10, 50, 100],
                    columns: option.columns,
                    onCheck: function (row) {
                        if (SelType) {
                            //单选
                            $("#hidselID").val(row.ID);
                        } else {
                            //多选
                            var selrow = $('#FTGrid').bootstrapTable("getSelections");
                            var selids = "";
                            for (var i = 0; i < selrow.length; i++) {
                                selids = selids + selrow[i].ID + ",";
                            }
                            if (selids.length > 1) {
                                selids = selids.substring(0, selids.length - 1);
                            }
                            $("#hidselID").val(selids);
                        }
                    },
                    onUncheck: function (row) {
                        if (SelType) {
                            //单选
                            $("#hidselID").val("");

                        } else {
                            var selrow = $('#FTGrid').bootstrapTable("getSelections");
                            var selids = "";
                            for (var i = 0; i < selrow.length; i++) {
                                selids = selids + selrow[i].ID + ",";
                            }
                            if (selids.length > 1) {
                                selids = selids.substring(0, selids.length - 1);
                            }
                            $("#hidselID").val(selids);
                        }

                    },
                    data: jQuery.parseJSON(tabledata)
                });
            });
            ComFunJS.InitQX('', FormCode, $("#hidselID"))
            if (ListType == "SELECT") {//List类型,LIST正常List页面,SELECT选择界面
                $(".addForm,.EditForm,.DelForm").remove();
            }
        
        });
        $("#FTGrid").on('load-success.bs.table', function (data) {
            alert(data)
        });
        function getseldata() {
            var selrow = $('#FTGrid').bootstrapTable("getSelections");
            return selrow;
        }
        function getselids() {
            return $("#hidselID").val();
        }
    </script>
</body>
</html>

